package utils;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;

public class StringUtils
{
    private static Charset charSet = Charset.forName("GBK");
    
    public static String decode(ByteBuffer buffer)
    {
        CharBuffer charBuffer = charSet.decode(buffer);
        return charBuffer.toString();
    }
    
    public static ByteBuffer encode(String string)
    {
        ByteBuffer charBuffer = charSet.encode(string);
        return charBuffer;
    }
}
